// slip-nav
let line = document.querySelector('.line');
let slipNav = document.querySelector('.slip-nav nav');
let slipAll = document.querySelectorAll('.slip-nav nav a');
//为a标签添加index属性
for (let i = 0; i < slipAll.length; i++) {
  slipAll[i].setAttribute('data-index', i)
}

//鼠标移入底下的线跟着移动
slipNav.addEventListener('mouseover',function (e) {
  let target = e.target
  let len = 109 * target.dataset.index + 24;// 计算当前的left值
  line.style.left = len + 'px';
})

